#!/bin/bash
# Gitee 环境检测脚本

echo "🔍 检测构建环境..."

# 检测是否在 Gitee CI 环境中
if [ ! -z "$GITEE_CI" ] || [ ! -z "$CI_BUILD_ID" ]; then
    echo "✅ 运行在 Gitee CI 环境"
    export IS_GITEE_CI=true
else
    echo "ℹ️  运行在本地环境"
    export IS_GITEE_CI=false
fi

# 检测系统架构
echo "🏗️  系统信息:"
echo "  - 架构: $(uname -m)"
echo "  - 系统: $(uname -s)"
echo "  - 内核: $(uname -r)"

# 检测必要的工具
echo "🛠️  工具检测:"
for tool in make bc bison flex gcc-aarch64-linux-gnu gcc-arm-linux-gnueabi; do
    if command -v $tool &> /dev/null; then
        echo "  ✅ $tool: 已安装"
    else
        echo "  ❌ $tool: 未安装"
    fi
done

# 设置 Gitee 专用环境变量
export GITEE_MIRROR=true
export USE_CN_MIRRORS=true
